﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Speech.Recognition;
using System.Text;
using System.Globalization;
using System.Net;
using System.IO;
using System.Net.Mail;


namespace speech
{
    public partial class WebForm1 : System.Web.UI.Page
    {
       
        protected void Page_Load(object sender, EventArgs e)
        {
            
           

        }
        protected void Btn_SendMail_Click(object sender, EventArgs e)
        {


          //retrieve the latitude and longtitude
            string lat = hiddenLat.Value;
            string lng = hiddenLng.Value;
           //create mail object for sending.
            MailMessage mailObj = new MailMessage("streetspeak@hotmail.com", EmailInput1.Text, "Street Speak location sharer",
               "<h3 style= font-family:Cursive>" + TextInput1.Text + " wishes to share a location with you on Street Speak.</h3><br /> " + TextArea1.InnerText +"<br/>Please enter in the following values at the following link :<a href=\"http://streetspeak.cloudapp.net/ShareLocation.aspx/\">Here</a> <br /> Latitude Value: " + lat + "<br />Longtitude Value: " + lng);

            mailObj.IsBodyHtml = true;
            SmtpClient SMTPServer = new SmtpClient("smtp.live.com");
        
            try
            {
                SMTPServer.Send(mailObj);
                MailSent.Visible = true;
                  
               
            }
            catch (Exception ex)
            {
              //Display the error page if the email fails to send
                Response.Redirect("EmailError.aspx");  
            }

        }

    }
}